<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%>
<%@ include file="/common/includes.jsp" %>
<html>
<head>
    <title>采购入库汇总表</title>
	<%@ include file="/common/meta.jsp" %>
	<script src="${ctx}/js/ligerUI/js/plugins/ligerLayout.js" type="text/javascript"></script>
	<script src="${ctx}/js/jsp/comm.js" type="text/javascript"></script>
	<script type="text/javascript">
		var basic_Url="${ctx}/logic/Reports";
		var basic_WUrl="/logic/Reports";
		var basic_Title="采购入库汇总表";
		var show_Width=380;
		var show_Hight=400;
		var grid;
		function createSearch(){
			init(2,8,'100,100,100,100,100,100,100,100','10%');
			//第一行的数据
			addCommon(0,0,"lable","物料名称：");
			addCommon(0,1,"txtlike","details.zd005MaterialsName");
			addCommon(0,2,"lable","物料编码：");
			addCommon(0,3,"txtlike","details.zd005MaterialsCode");
			addCommon(0,4,"lable","物料规格：");
			addCommon(0,5,"txtlike","details.zd006MaterialsSpec");
			addCommon(0,6,"lable","物料型号：");
			addCommon(0,7,"txtlike","details.zd007MaterialsModel");
			addCommon(1,0,"lable","入库起始时间：");
			addCommon(1,1,"datestart","pcsw.zd013Date");
			addCommon(1,2,"lable","入库结束时间：");
			addCommon(1,3,"dateend","pcsw.zd013Date");
		}
		
		function searchAP(){
			multipleSearch("#table1",true,"",basic_Url+"/pcswSumList.do");
		}
		document.onkeydown=keyListener;   
		function keyListener(e){   
		    e = e ? e : event;  
		    if(e.keyCode == 13){   
		    	searchAP();
		    }   
		}
		function pcswSumEdit(data){
			getDG().dialog({
				title : '选择仓库',
				width : 650,
				height : 350,
				parms:[{ name : 'roleQuery' , value : 'y'}],
				content : 'url:' + sys_context + '/public/windowalert/sotrageinfo.do',    
				lock : true,
				max : true,
				min : true,
				ok : function() {
					var rows = this.content.getSelected();
					if(rows==null){
						$.dialog.alert("请选择数据");
						return;
					}
					else{
						if(rows.length>1){
							$.dialog.alert('只能选择一行数据!');
							return;
						}else{
							$(rows).each(function() {
								$("#zd005WhId").val(this.id);
								$("#zd006WhCode").val(this.zd002Code);
								$("#zd007WhName").val(this.zd003Name);
						  });
						}
					}
					this.content.Close();
					return false;
				},
				cancelVal : '关闭',
				cancel : true
			}).zindex();
		}
		//查看详细记录
		function pcswSumEdit1(data){
			//物料id
			var materId = data.zd001MaterId;
			var url = basic_WUrl+"/pcswDetail.do?materId="+materId;
			//物料名称
			var materName = $("#details\\.zd005MaterialsName").val();
			if(materName!=''&&materName!=null&&materName!=undefined){
				url = url + "&materName="+materName;
			}
			//物料编码
			var materCode = $("#details\\.zd005MaterialsCode").val();
			if(materCode!=''&&materCode!=null&&materCode!=undefined){
				url = url + "&materCode="+materCode;
			}
			//物料规格
			var materSpec = $("#details\\.zd006MaterialsSpec").val();
			if(materSpec!=''&&materSpec!=null&&materSpec!=undefined){
				url = url + "&materSpec="+materSpec;
			}
			//物料型号
			var materModel = $("#details\\.zd007MaterialsModel").val();
			if(materModel!=''&&materModel!=null&&materModel!=undefined){
				url = url + "&materModel="+materModel;
			}
			//入库起始时间
			var markBeginDate = $("#pcsw\\.zd013Date").val();
			if(markBeginDate!=''&&markBeginDate!=null&&markBeginDate!=undefined){
				url = url + "&markBeginDate="+markBeginDate;
			}
			//入库结束时间
			var markEndDate = $("#pcsw\\.zd013Date").val();
			if(markEndDate!=''&&markEndDate!=null&&markEndDate!=undefined){
				url = url + "&markEndDate="+markEndDate;
			}
			ShowIframeDialog("operate","采购入库详情",url,show_Width,show_Hight);
		}
		$(function(){
			grid = $("#table1").ligerGrid({
		        columns: [
		                  { display: '物料id', name: 'zd001MaterId', width:1,hide:true},
		                  { display: '物料编码', name: 'zd001MaterCode', width:120},
		                  { display: '物料名称', name: 'zd001MaterName', width: 120},
		                  { display: '规格型号', name: 'zd001MaterModel', width:100},
		                  { display: '物料尺寸', name: 'zd001MaterSpec', width:100},
		                  { display: '物料颜色', name: 'zd001MaterColor', width:100},
		                  { display: '物料材质', name: 'zd001MaterQuanlity', width:100},
		                  { display: '单位', name: 'zd001MaterUnit', width:80},
		                  { display: '数量 ', name: 'zd002SumQuantity', width: 100,render: function (item){
		                		if(item.zd002SumQuantity==''||item.zd002SumQuantity==null||parseFloat(item.zd002SumQuantity)==0){
		                			return '0.0000';
		                		}
		                	 	return item.zd002SumQuantity.toFixed(4);
		                  }},
		                  { display: '总金额', name: 'zd003SumMoney', width: 100,render: function (item){
		                		if(item.zd003SumMoney==''||item.zd003SumMoney==null||parseFloat(item.zd003SumMoney)==0){
		                			return '0.0000';
		                		}
		                	 	return item.zd003SumMoney.toFixed(4);
		                  }}
		                  ],
		                  enabledEdit: true,
		                  usePager: true, rownumbers: true, 
		                  pageSize:15,
		                  pageSizeOptions :[15,25,35],
		                  url:basic_Url+"/pcswSumList.do",
		                  width: "100%", height:'100%',
		                  enabledSort:false,
		                  onDblClickRow : function (data, rowindex, rowobj){
		                	  //pcswSumEdit(data);
	                      }
		             });
				$("#pageloading").hide();
			});
		</script>
</head>
 <body style="padding:10px" onload="createSearch()">  
       <div id="layout1">

          <div id="pageHeader" class="pageHeader">
               <div class="searchBar" id="multipleSearchDialog">
	                <table class="table" width="100%" id="searchHeader" >  
                        <tbody id="newbody">
                        </tbody>
 	                </table>
                    <div class="subBar">
			             <ul>
				             <li><div class="buttonActive"><div class="buttonContent"><button type="submit" id="btnSearch" onclick="searchAP()">查询</button></div></div></li>
				             <li><a class="button" onclick="clearSearch()"><span>重置</span></a></li>
			             </ul>
	                </div>
               </div>
          </div>
      </div>
      <div position="center" id="table1">
      </div>
      <div class="clear"></div>
    </body>
</html>